fix(seo): split sitemap into index + chunked children#35
Merged
Conversation
The interim ISR fix (#34) made the sitemap fast but, because the Docker build has no DB, served only the ~29 static URLs on cold instances (the service scales to zero) — the ~6.7k agent/skill pages were missing. Switch to Next's generateSitemaps() splitting, staying force-dynamic so the catalog is always complete: - /sitemap.xml becomes a small, instant index (production) - /sitemap/{id}.xml children: id 0 = static/blog/scenario pages; the rest are APPROVED agents then skills, 1000 URLs per file. Each child is small and fast, so Google fetches them independently without timing out. Note: Next passes `id` as Promise<string>; await + Number() it (a plain === number comparison silently falls through). Verified id=0 renders the page routes (200, valid XML, hreflang intact) on a local dev server. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #34. The interim ISR fix made the sitemap fast but, since the Docker build has no DB and the Cloud Run service scales to zero, cold instances served only the ~29 static URLs — the ~6.7k agent/skill pages were missing from the sitemap.
Fix
Use Next's
generateSitemaps()to split, stayingforce-dynamicso the catalog is always complete:/sitemap.xml→ small, instant index (generated in production builds)./sitemap/{id}.xmlchildren →id 0= static/blog/scenario pages; the rest are APPROVED agents then skills, 1,000 URLs/file. Each child is small and fast, so Google fetches them independently without the ~13s/12MB monolith timeout.Notes / verification
idasPromise<string>— mustNumber(await id); a plain=== numbercheck silently falls through (caught locally — it was hitting prisma on the wrong branch)./sitemap/0.xml→ 200, valid XML, 29 page URLs with 15-locale hreflang intact./sitemap.xmlindex is a production-only artifact (dev serves only children), so it's verified post-deploy.🤖 Generated with Claude Code